package com.pilipili.zeus.statistics.controller;


import com.pilipili.commonutils.Result;
import com.pilipili.zeus.statistics.service.DailyService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 网站统计日数据 前端控制器
 *
 * @author Unlimited_Blade_Works
 * @since 2021-06-03
 */
@RestController
@RequestMapping("/statistics/daily")
public class DailyController {
    @Autowired
    private DailyService dailyService;

    @ApiOperation(value = "统计注册人数")
    @PostMapping("registerCount/{day}")
    public Result registerCount(@PathVariable String day){
        dailyService.registerCount(day);
        return Result.ok();
    }
    @ApiOperation(value = "提交统计数据")
    @GetMapping("showData/{type}/{begin}/{end}")
    public Result showData(@PathVariable String type,
                           @PathVariable String begin,
                           @PathVariable String end){
       Map<String,Object> map = dailyService.getData(type,begin,end);
        return Result.ok().data(map);
    }
}

